﻿#if __DEUPLCATED__

using System;
using System.Text;
using System.Drawing;
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;

public static partial class NativeAOT
{
    [UnmanagedCallersOnly(EntryPoint = "funpqj")]
    public static unsafe void funpqj(IntPtr x_ptr, IntPtr y_ptr, IntPtr b_ptr, int j)
    {
        double* x = (double*)x_ptr.ToPointer();
        double* y = (double*)y_ptr.ToPointer();
        double* b = (double*)b_ptr.ToPointer();

        funpqj(x, y, b, j);
    }

    /// <summary>
    /// 计算函数连分式新一节
    /// </summary>
    /// <param name="x">x存放结点值x[0]～x[j]</param>
    /// <param name="y">y存放结点函数值y[0]～y[j]</param>
    /// <param name="b">b存放连分式中的参数b[0]～b[j-1]，返回时新增加b[j]。</param>
    /// <param name="j">j连分式增加的节号。即本函数计算新增加的b[j]。</param>
    public static unsafe void funpqj(double* x, double* y, double* b, int j)
    {
        int k, flag = 0;
        double u;

        u = y[j];
        for (k = 0; (k < j) && (flag == 0); k++)
        {
            if ((u - b[k]) + 1.0 == 1.0)
            {
                flag = 1;
            }
            else
            {
                u = (x[j] - x[k]) / (u - b[k]);
            }
        }
        if (flag == 1)
        {
            u = 1.0e+35;
        }
        b[j] = u;
        return;
    }
}

#endif
